home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
comm2
/
termsorc.lha
/
Extras
/
Source
/
gtlayout-source.lha
/
LTP_MakeMenu.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-24
|
1KB
|
56 lines
/* GadTools layout toolkit
**
** Copyright © 1993-1995 by Olaf `Olsen' Barthel
** Freely distributable.
**
** :ts=4
*/
#include "gtlayout_global.h"
#ifdef DO_MENUS
/* LTP_MakeMenu(RootMenu *Root,MenuNode *Menu,struct NewMenu *Template):
*
* Create a single menu and fill it in.
*/
MenuNode * __regargs
LTP_MakeMenu(RootMenu *Root,MenuNode *Menu,struct NewMenu *Template)
{
// If none is provided, roll our own
if(!Menu)
Menu = (MenuNode *)AsmAllocPooled(Root -> Pool,sizeof(MenuNode),SysBase);
if(Menu)
{
STRPTR Label = Template -> nm_Label;
// Use the screen font for the layout
SetFont(&Root -> RPort,Root -> DrawInfo -> dri_Font);
// Fill in the size
Menu -> Menu . Width = TextLength(&Root -> RPort,Label,strlen(Label)) + 6;
Menu -> Menu . Height = Root -> Screen -> BarHeight;
Menu -> Menu . MenuName = (BYTE *)Label;
Menu -> UserData = Template -> nm_UserData;
// Return to the original font
SetFont(&Root -> RPort,Root -> Font);
// Take care of the only valid bit
if(!(Template -> nm_Flags & NM_MENUDISABLED))
Menu -> Menu . Flags = MENUENABLED;
}
return(Menu);
}
#endif /* DO_MENUS */